#ifndef __PEN_H__
#define __PEN_H__
#include <easyx.h>
#include <cmath>
class Pen {
    private:
    int x,y;
    public:
    Pen():x(0),y(0) {}
    Pen(int nx,int ny):x(nx),y(ny) {}
    void moveTo(int x,int y) {
        this->x = x;
        this->y = y;
    }
    void drawTo(int tox,int toy) {
        line(x,y,tox,toy);
        x = tox;
        y = toy;
    }
    void drawDirect(double length,double angle) {
        double rad = angle/180*3.14159265259;
        line(x,y,x + length*cos(rad),y - length*sin(rad));
        x = x + length*cos(rad);
        y = y - length*sin(rad);
    }
    void drawCoor(int addx,int addy) {
        line(x,y,x+addx,y+addy);
        x += addx;
        y += addy;
    }
};
#endif